import React, { useState, useEffect } from "react";
import { useLocation } from 'react-router-dom';
export default function LjwSc() {
  const location = useLocation();
  // 获取父组件传递的 formData
  const receivedData = location.state?.formData || {};
  
  const receivedDatas = location.state?.result || {};
  console.log(receivedData)
  const classTxt=receivedDatas.replace(/[^\u4e00-\u9fa5 .0-9a-zA-Z\n]/g, '');
  

  return (
    <div>
      <div style={{textAlign:'center'}}>
      
      <h1 style={{width:'50%',marginLeft:'25%',}}>{receivedData.name}的运势</h1>
      <p style={{width:'50%',marginLeft:'25%',}}>性别：{receivedData.gender}</p>
      {/* 其他字段展示... */}
      <div>
        {/* {receivedDatas} */}
        {classTxt.split('\n').map((paragraph, index) => (
            <div key={index} style={{border:' 1px solid orange',width:'50%',marginLeft:'25%',marginTop:'10px'}}>{paragraph}</div>
          ))}
      </div>
      </div>
   
    </div>
  )
}
